import React, {Component} from 'react';
import axios from 'axios'
import {Carousel} from 'antd';

class Swiper extends Component {
    constructor(props) {
        super(props)
        this.state = {
            bannerList: []
        }
    }

    render() {
        return (
            <div>
                <div className="banner">
                    <Carousel autoplay>
                        {
                            this.state.bannerList.map((item,index)=>{
                                return (
                                    <div key={index}>
                                        <img src={item.image} alt=""/>
                                    </div>
                                )
                            })
                        }
                    </Carousel>
                </div>
                <div className="shopList">

                </div>
            </div>

        );
    }

    componentDidMount() {
        axios.get('http://vueshop.glbuys.com/api/home/index/slide?token=1ec949a15fb709370f').then((res) => {
            const data = res.data.data
            console.log(data)
            this.setState({
                bannerList: data
            })
        })
    }
}

export default Swiper;